<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <link rel="stylesheet"  th:href="@{/css/file.css}" />
    <link rel="stylesheet"  th:href="@{/css/bootstrap.css}" />
    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <script th:src="@{/js/jquery.js}"></script>
    <script th:src="@{/js/bootstrap.js}"></script>
    <script type="text/javascript" th:src="@{/js/bootstrap-paginator.js}"></script>
    <script th:src="@{/js/semantic.min.js}"></script>

    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<!--    弹出框删除-->
<div class="ui basic modal" id="deletemodal">
    <h2 class="header">
        删除课程
    </h2>
    <div class="content">
        删除课程
    </div>
    <form th:action="@{/stu/center/course_test/delete}" method="post">
        <input type="hidden" id="getid" name="id">
        <div class="actions">
            <button class="ui negative button" type="button">否</button>
            <button class="ui positive button" type="submit">是</button>
        </div>
    </form>
</div>
<!--    弹出框删除-->

<!--管理界面-->
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <!--                搜索框-->
                <!--                搜索框-->
                <div class="layui-card-header">
                    <a class="layui-btn" href="" ><i class="layui-icon layui-icon-refresh-3"></i> 刷新</a>
                </div>
                <!--                列表-->
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>用户名</th>
                            <th>出生日期</th>
                            <th>邮箱</th>
                            <th>积分</th>
                            <th>状态</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        <tr th:each="user:${users}">
                            <td th:text="${user.getUsername()}"></td>
                            <td th:text="${#dates.format(user.getBirth(),'yyyy年MM月dd日')}"></td>
                            <td th:text="${user.getEmail()}"></td>
                            <td th:text="${user.getScore()}"></td>
                            <td th:text="${user.getStatus()==1?'已启用':'已禁用'}"></td>
                            <td>
                                <button class="ui orange button" th:onclick="|change_status(${user.getId()},${user.getStatus()})|" th:text="${user.getStatus()==0?'启用':'禁用'}">
                                </button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <!--使用bootstrop-paginot实现分页-->
                    <!--                    <ul id="pagination"></ul>-->
                </div>
                <!--                列表-->
            </div>
        </div>
    </div>
</div>
<!--管理界面-->
</body>
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;


        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });

    });



    layui.use('form', function() {
        var form = layui.form;

        //进行表单验证
        layui.use('form', function() {
            var form = layui.form;
            //各种基于事件的操作，下面会有进一步介绍
            form.verify({
                image: function (value, item) {
                    if (!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(value)) {
                        return '图片格式错误';
                    }
                },
                video:function (value,item) {
                    if (!/\.(mp4)$/.test(value)) {
                        return '视频格式错误';
                    }
                }
            })
        });
        //进行表单验证
    });


    //修改状态
    function change_status(id,status) {
        alert('修改成功');
        $.post(
            '/admin/change/status',
            {'id':id,'status':status},
            function () {
                //刷新页面
                location.href = '/admin/user_teacher';
            }
        )
    }

</script>
</html>